.outline-editor {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 400px;
  position: relative;
  overflow: hidden;
  background-color: var(--n-card-color); /* 与激活标签背景色一致 */
}

.loading-container,
.empty-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100%;
  gap: 16px;
}

.loading-text {
  color: var(--n-text-color-2);
  font-size: 14px;
}

.editor-container {
  display: flex;
  flex-direction: column;
  height: calc(100% - 48px); /* 减去底部标签页高度，确保内容区域填满剩余空间 */
  flex: 1;
  min-height: 0; /* 确保内容可以正确收缩 */
  overflow: hidden;
  background-color: var(--n-card-color); /* 与激活标签背景色一致 */
}

.editor-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0; /* 确保内容可以正确收缩 */
  background-color: var(--n-card-color); /* 与激活标签背景色一致 */
}

.editor-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

.content-editor {
  height: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.editor-input-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

/* 自定义滚动条样式 */
.custom-scrollbar {
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--n-scrollbar-color) transparent;
}

.custom-scrollbar::-webkit-scrollbar {
  width: 10px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 5px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #18a058, #36ad6a);
  border-radius: 5px;
  border: 1px solid var(--n-border-color);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #36ad6a, #18a058);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.custom-scrollbar::-webkit-scrollbar-thumb:active {
  background: linear-gradient(180deg, #0e7c3f, #18a058);
}

/* 编辑器文本区域样式 */
.content-editor :deep(.n-input__textarea-el) {
  height: 100% !important;
  resize: none;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  line-height: 1.6;
  padding: 16px;
  box-sizing: border-box;
  border-radius: var(--n-border-radius);
  border: 1px solid var(--n-border-color);
}

/* 文本输入框样式调整 */
:deep(.content-editor .n-input__textarea) {
  height: 100% !important;
  min-height: 0 !important;
  resize: none !important;
}

:deep(.content-editor .n-input) {
  height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
}

/* 预览区域样式 */
.preview-pane {
  padding: 0px 20px 20px 20px;
  box-sizing: border-box;
  background-color: var(--n-card-color); /* 与编辑区背景色一致 */
  border-radius: var(--n-border-radius);
  border: 1px solid var(--n-border-color);
  height: 100%;
  min-height: 0; /* 确保内容可以正确收缩 */
  overflow-y: auto; /* 添加垂直滚动 */
  line-height: 1.8; /* 增加行高，与MarkdownRenderer保持一致 */
}

/* 归档按钮样式 */
.archive-btn {
  position: relative;
}

.archive-btn::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, transparent, rgba(24, 160, 88, 0.1), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.archive-btn:hover::after {
  opacity: 1;
}

/* 加载动画样式 */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.loading-container .n-spin {
  animation: pulse 1.5s infinite ease-in-out;
}

/* 对话框样式优化 */
.generate-outline-modal,
.generate-chapters-modal {
  max-height: 80vh;
  overflow-y: auto;
}

.generate-form {
  padding: 16px 0;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .outline-editor {
    padding: 12px;
  }
  
  .editor-content {
    padding: 8px;
  }
  
  .preview-pane {
    padding: 16px;
    line-height: 1.7; /* 在小屏幕上稍微减小行高 */
  }
  
  .content-editor :deep(.n-input__textarea-el) {
    padding: 12px;
  }
}

/* 确保编辑器和预览区高度一致，并修复标签页头部消失问题 */
:deep(.n-tabs) {
  display: flex;
  flex-direction: column;
  height: auto; /* 改为自动高度 */
}

:deep(.n-tabs-nav) {
  flex-shrink: 0;
  position: relative; /* 改为相对定位 */
  z-index: 10;
  background-color: var(--n-color-hover) !important; /* 略深的灰色背景，与未选中标签一致，强制应用 */
  padding: 0;
  margin: 0;
  border-top: 1px solid var(--n-border-color);
  border-bottom: none;
}

:deep(.n-tabs-nav-wrapper) {
  background-color: var(--n-color-hover) !important; /* 略深的灰色背景，与导航栏一致，强制应用 */
}

:deep(.n-tabs-nav-scroll-content) {
  background-color: var(--n-color-hover) !important; /* 略深的灰色背景，与未选中标签一致，强制应用 */
}

:deep(.n-tabs-pane-wrapper) {
  display: none; /* 隐藏标签页内容区域，因为我们已经将内容移出 */
}

:deep(.n-tab-pane) {
  display: none; /* 隐藏标签页内容区域，因为我们已经将内容移出 */
}